﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Search : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string type = Request.QueryString["type"];
        string keyword = Request.QueryString["keyword"];// de lay thong tin 1 san pham
        keyword = TTQT.TTQT_Code.TTQTCommon.isNull(keyword, "");
        type = TTQT.TTQT_Code.TTQTCommon.isNull(type, "");
        Response.ContentType = "application/json";
        if(string.IsNullOrEmpty(type))
        {
            Response.Write("");
        }
        //search với keyword
        //but/ajax/Search.aspx?type=name&keyword=vân đỏ
        if(type.Equals("name"))
        {
            Response.Write(new SanPhamDAO().sanPham_TimKiem_Json(keyword));
        }
        if (type.Equals("auto"))
        {
            Response.Write(new SanPhamDAO().sanPham_autoCompleteName_json(keyword));
        }
    }
}
